package detailsdb.servlet;

import com.alibaba.fastjson.JSON;
import detailsdb.entity.Detailsdb;
import detailsdb.service.DetailsdbService;
import detailsdb.service.impl.DetailsdbServiceImpl;

import javax.mail.Session;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@WebServlet("/ListDeServlet")
public class ListDeServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");

        String orderNumber=request.getParameter("orderNumber");

        DetailsdbService service=new DetailsdbServiceImpl();
        List<Detailsdb> resultList=service.getList(orderNumber);

        request.setAttribute("list",resultList);
        request.getRequestDispatcher("details.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
